/**
 * MDF 前端框架
 *
 * Copyright (c) 2011 Zhao Yong (7tudou@gmail.com)
 *
 * @version 1.1.1
 * @author Zhao Yong
 * @mailto 7tudou@gmail.com
 * @modify Zhao Yong
 * @edit by...
 **/
 
/* 可以重载的框架级属性及方法 */
/*
G.GlobalLoading = "<div pclass='g-loading' style='display:none;top:0;left:0'>Loadding...</div>";
G.LoadingCss = "g-loading-on";
G.ResultSplitChar = "êêê";
G.LanguageMapping = {
	duplicate_definition_property_module: "Module属性不能被占用！"
};
G.CpsSet = {};//Cps设置
$.UT.Alert = function(text, title, confirm){
	alert(text);
};
$.UT.DefaultSuccessCallback = function(data,attach){
    $.UT.Alert(data);
};
$.UT.DefaultErrorCallback = function(errors,data){
    var s='', i, error, msg;
    for (i in errors) {
        error = errors[i];
        msg = P.Set.Errors[error.eid];
        s += '('+error.eid+')' + msg + "\n" + "file:" + error.file + "\n" + "line:" + error.line + "\n" + "note:" + error.note; 
    }
    $.UT.Alert(s);
};
$.CL.Result.prototype.decode = function(str){
	
};

*/

/* 项目开始 */
P.Set = {
    Errors: '', //错误代码对应的错误信息
    ErrorMapping: '', //错误代码的本地映射
    LanguageMapping: {}, //语言包
    Domain: '', //当前网站的Domain
    DomainOK: '', //给当前网站设置Domain是否成功
    Config: {}, // 初始设置
    RemoteService: '', //远程服务连接URL
    ActionMapping: {}, //远程服务连接地址映射
    UserLoginUrl:'', //用户登录地址
    DocCps: null
};



(function () {
    var href = location.href.split('//')[1];
    P.Set.Domain = href.split('/')[0];
    P.Set.DomainOK = 1;
    try {
        document.domain = P.Set.Domain;
    }catch (x) {
        P.Set.DomainOK = 0;
    }
} ());
P.Set.Config = $.UT.JsonDecode(document.body.getAttribute("config"));
P.Set.RemoteService = "http://" + P.Set.Domain + "/";
P.Set.UserLoginUrl = "http://" + P.Set.Domain + "/";

(function () {
    if(P.Set.Config){
        P.Set.DocCps = $(document.body).Widget("Cps",{
            type : 1, 
            timestamp : P.Set.Config.Timestamp,
            domain : P.Set.Domain
        });
    }
    
} ());

